object ForBindingDemo extends App {
  val names: List[String] = List("张三", "李四", "王五", "赵六", "孙七")
  val scores: List[Int] = List(85, 92, 78, 65, 90)

  println("学生成绩等级：")
  for (score <- scores) {
    val level = if (score >=90) "A"
                else if (score >=80) "B"
                else if (score >= 70) "C"
                else if (score >=60) "D"
                else "F"
    println(s"成绩：$score -> 等级：$level")
  }

  println("\n学生成绩详情：")
  for {
    name <- names
    score <- scores
    if names.indexOf(name) == scores.indexOf(score)
  } {
    val level = if (score >= 90) "优秀" else "良好"
    println(s"$name:$score 分（$level）")
  }

  println("\n使用zip组合：")
  for ((name, score) <- names.zip(scores)) {
    println(s"$name 的成绩是 $score 分")
  }
}
//第九周（动手练习3：处理学生成绩与姓名对应关系）